package com.se2.antiqueexhibition.Controller;

import com.se2.antiqueexhibition.pojo.User;
import com.se2.antiqueexhibition.Service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.server.Session;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import jakarta.servlet.http.HttpSession;

@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/personal")
    public String personal(HttpSession session) {
        System.out.println("调用了控制层");
        User user = userService.getUserById(1);
        session.setAttribute("user", user);
        System.out.println(user.getUserName());
        return "user";
    }
}